#include "GameScreen.h"
#include <allegro.h>
#include <iostream>
#include "../game/entities/RocketDude.h"
#include "../game/entities/Rock.h"

GameScreen::GameScreen() {
    //mBackground = load_bitmap("graphics/ohlol.bmp",NULL);
    std::cout<< "Entering gameScreen\n";
    
    for(int x_and_y = 100; x_and_y < 400; x_and_y += 60){
        Rect *rockPos = new Rect();
        Rock *rock = new Rock();
        rockPos->posX = x_and_y;
        rockPos->posY = x_and_y;
        rockPos->width = 50;
        rockPos->height = 50;
        rock->setPos(rockPos);
        mDrawManager.addEntity(rock, DrawManager::STATIC);
    }

    RocketDude * dude = new RocketDude(110,1);
    Rect *dudePos = new Rect();
    dudePos->posX = 100;
    dudePos->posY = 100;
    dudePos->width = 50;
    dudePos->height = 50;
    dude->setPos(dudePos);
    mDrawManager.addEntity(dude, DrawManager::CHAR);

    //mScreen = create_bitmap(SCREEN_W,SCREEN_H);
    mScreen = create_bitmap(800,600);
}

GameScreen::~GameScreen() {
    destroy_bitmap(mScreen);
}

BITMAP * GameScreen::draw() {
    clear_to_color(mScreen, makecol(255, 255, 255));      
    mDrawManager.drawAll(mScreen);
    return mScreen;
}

